@backstage/plugin-scaffolder-backend-module-confluence-to-markdown 0.1.2-next.0 → 0.1.2-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # @backstage/plugin-scaffolder-backend-module-confluence-to-markdown
2
2
 
3
+ ## 0.1.2-next.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+ - @backstage/backend-common@0.18.5-next.1
9
+ - @backstage/plugin-scaffolder-backend@1.13.2-next.1
10
+ - @backstage/plugin-scaffolder-node@0.1.3-next.1
11
+ - @backstage/config@1.0.7
12
+
3
13
  ## 0.1.2-next.0
4
14
 
5
15
  ### Patch Changes
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs.js","sources":["../src/actions/confluence/helpers.ts","../src/actions/confluence/confluenceToMarkdown.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Config } from '@backstage/config';\nimport { ResponseError, ConflictError, InputError } from '@backstage/errors';\nimport fs from 'fs-extra';\nimport fetch, { Response } from 'node-fetch';\n\ninterface Links {\n webui: string;\n download: string;\n thumbnail: string;\n self: string;\n}\n\ninterface Metadata {\n mediaType: string;\n}\n\nexport interface Result {\n id: string;\n type: string;\n status: string;\n title: string;\n metadata: Metadata;\n _links: Links;\n}\n\nexport interface Results {\n results: Result[];\n}\n\nexport const readFileAsString = async (fileDir: string) => {\n const content = await fs.readFile(fileDir, 'utf-8');\n return content.toString();\n};\n\nexport const fetchConfluence = async (relativeUrl: string, config: Config) => {\n const baseUrl = config.getString('confluence.baseUrl');\n const token = config.getString('confluence.token');\n const response: Response = await fetch(`${baseUrl}${relativeUrl}`, {\n method: 'GET',\n headers: {\n Authorization: `Bearer ${token}`,\n },\n });\n if (!response.ok) {\n throw await ResponseError.fromResponse(response);\n }\n\n return response.json();\n};\n\nexport const getAndWriteAttachments = async (\n arr: Results,\n workspace: string,\n config: Config,\n mkdocsDir: string,\n) => {\n const productArr: string[][] = [];\n const baseUrl = config.getString('confluence.baseUrl');\n const token = config.getString('confluence.token');\n await Promise.all(\n await arr.results.map(async (result: Result) => {\n const downloadLink = result._links.download;\n const downloadTitle = result.title.replace(/ /g, '-');\n if (result.metadata.mediaType !== 'application/gliffy+json') {\n productArr.push([result.title.replace(/ /g, '%20'), downloadTitle]);\n }\n\n const res = await fetch(`${baseUrl}${downloadLink}`, {\n method: 'GET',\n headers: {\n Authorization: `Bearer ${token}`,\n },\n });\n if (!res.ok) {\n throw ResponseError.fromResponse(res);\n } else if (res.body !== null) {\n fs.openSync(`${workspace}/${mkdocsDir}docs/img/${downloadTitle}`, 'w');\n const writeStream = fs.createWriteStream(\n `${workspace}/${mkdocsDir}docs/img/${downloadTitle}`,\n );\n res.body.pipe(writeStream);\n await new Promise((resolve, reject) => {\n writeStream.on('finish', () => {\n resolve(`${workspace}/${mkdocsDir}docs/img/${downloadTitle}`);\n });\n writeStream.on('error', reject);\n });\n } else {\n throw new ConflictError(\n 'No Body on the response. Can not save images from Confluence Doc',\n );\n }\n }),\n );\n return productArr;\n};\n\nexport const createConfluenceVariables = async (url: string) => {\n let spacekey: string | undefined = undefined;\n let title: string | undefined = undefined;\n let titleWithSpaces: string | undefined = '';\n const params = new URL(url);\n if (params.pathname.split('/')[1] === 'display') {\n spacekey = params.pathname.split('/')[2];\n title = params.pathname.split('/')[3];\n titleWithSpaces = title?.replace(/\\+/g, ' ');\n return { spacekey, title, titleWithSpaces };\n }\n throw new InputError(\n 'The Url format for Confluence is incorrect. Acceptable format is `<CONFLUENCE_BASE_URL>/display/<SPACEKEY>/<PAGE+TITLE>`',\n );\n};\n","/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { Config } from '@backstage/config';\nimport { UrlReader } from '@backstage/backend-common';\nimport { ScmIntegrations } from '@backstage/integration';\nimport { createFetchPlainAction } from '@backstage/plugin-scaffolder-backend';\nimport { createTemplateAction } from '@backstage/plugin-scaffolder-node';\nimport { InputError, ConflictError } from '@backstage/errors';\nimport { NodeHtmlMarkdown } from 'node-html-markdown';\nimport fs from 'fs-extra';\nimport parseGitUrl from 'git-url-parse';\nimport YAML from 'yaml';\nimport {\n readFileAsString,\n fetchConfluence,\n getAndWriteAttachments,\n createConfluenceVariables,\n} from './helpers';\n\n/**\n * @public\n */\n\nexport const createConfluenceToMarkdownAction = (options: {\n reader: UrlReader;\n integrations: ScmIntegrations;\n config: Config;\n}) => {\n const { config, reader, integrations } = options;\n const fetchPlainAction = createFetchPlainAction({ reader, integrations });\n type Obj = {\n [key: string]: string;\n };\n\n return createTemplateAction<{\n confluenceUrls: string[];\n repoUrl: string;\n }>({\n id: 'confluence:transform:markdown',\n schema: {\n input: {\n properties: {\n confluenceUrls: {\n type: 'array',\n title: 'Confluence URL',\n description:\n 'Paste your confluence url. Ensure it follows this format: https://{confluence+base+url}/display/{spacekey}/{page+title}',\n items: {\n type: 'string',\n default: 'Confluence URL',\n },\n },\n repoUrl: {\n type: 'string',\n title: 'GitHub Repo Url',\n description:\n 'mkdocs.yml file location inside the github repo you want to store the document',\n },\n },\n },\n },\n async handler(ctx) {\n const { confluenceUrls, repoUrl } = ctx.input;\n const parsedRepoUrl = parseGitUrl(repoUrl);\n const filePathToMkdocs = parsedRepoUrl.filepath.substring(\n 0,\n parsedRepoUrl.filepath.lastIndexOf('/') + 1,\n );\n const dirPath = ctx.workspacePath;\n let productArray: string[][] = [];\n\n ctx.logger.info(`Fetching the mkdocs.yml catalog from ${repoUrl}`);\n\n // This grabs the files from Github\n const repoFileDir = `${dirPath}/${parsedRepoUrl.filepath}`;\n await fetchPlainAction.handler({\n ...ctx,\n input: {\n url: `https://${parsedRepoUrl.resource}/${parsedRepoUrl.owner}/${parsedRepoUrl.name}`,\n targetPath: dirPath,\n },\n });\n\n for (const url of confluenceUrls) {\n const { spacekey, title, titleWithSpaces } =\n await createConfluenceVariables(url);\n // This calls confluence to get the page html and page id\n const getConfluenceDoc = await fetchConfluence(\n `/rest/api/content?title=${title}&spaceKey=${spacekey}&expand=body.export_view`,\n config,\n );\n if (getConfluenceDoc.results.length === 0) {\n throw new InputError(\n `Could not find document ${url}. Please check your input.`,\n );\n }\n // This gets attachements for the confluence page if they exist\n const getDocAttachments = await fetchConfluence(\n `/rest/api/content/${getConfluenceDoc.results[0].id}/child/attachment`,\n config,\n );\n\n if (getDocAttachments.results.length) {\n fs.mkdirSync(`${dirPath}/${filePathToMkdocs}docs/img`, {\n recursive: true,\n });\n productArray = await getAndWriteAttachments(\n getDocAttachments,\n dirPath,\n config,\n filePathToMkdocs,\n );\n }\n\n ctx.logger.info(\n `starting action for converting ${titleWithSpaces} from Confluence To Markdown`,\n );\n\n // This reads mkdocs.yml file\n const mkdocsFileContent = await readFileAsString(repoFileDir);\n const mkdocsFile = await YAML.parse(mkdocsFileContent);\n ctx.logger.info(\n `Adding new file - ${titleWithSpaces} to the current mkdocs.yml file`,\n );\n\n // This modifies the mkdocs.yml file\n if (mkdocsFile !== undefined && mkdocsFile.hasOwnProperty('nav')) {\n const { nav } = mkdocsFile;\n if (!nav.some((i: Obj) => i.hasOwnProperty(titleWithSpaces))) {\n nav.push({\n [titleWithSpaces]: `${titleWithSpaces.replace(/\\s+/g, '-')}.md`,\n });\n mkdocsFile.nav = nav;\n } else {\n throw new ConflictError(\n 'This document looks to exist inside the GitHub repo. Will end the action.',\n );\n }\n }\n\n await fs.writeFile(repoFileDir, YAML.stringify(mkdocsFile));\n\n // This grabs the confluence html and converts it to markdown and adds attachments\n const html = getConfluenceDoc.results[0].body.export_view.value;\n const markdownToPublish = NodeHtmlMarkdown.translate(html);\n let newString: string = markdownToPublish;\n productArray.forEach((product: string[]) => {\n // This regex is looking for either [](link to confluence) or ![](link to confluence) in the newly created markdown doc and updating it to point to the versions saved(in ./docs/img) in the local version of GitHub Repo during getAndWriteAttachments\n const regex = product[0].includes('.pdf')\n ? new RegExp(`(\\\\[.*?\\\\]\\\\()(.*?${product[0]}.*?)(\\\\))`, 'gi')\n : new RegExp(`(\\\\!\\\\[.*?\\\\]\\\\()(.*?${product[0]}.*?)(\\\\))`, 'gi');\n newString = newString.replace(regex, `$1./img/${product[1]}$3`);\n });\n\n ctx.logger.info(`Adding new file to repo.`);\n await fs.outputFile(\n `${dirPath}/${filePathToMkdocs}docs/${titleWithSpaces.replace(\n /\\s+/g,\n '-',\n )}.md`,\n newString,\n );\n }\n\n ctx.output('repo', parsedRepoUrl.name);\n ctx.output('owner', parsedRepoUrl.owner);\n },\n });\n};\n"],"names":["fs","fetch","ResponseError","ConflictError","InputError","createFetchPlainAction","createTemplateAction","parseGitUrl","YAML","NodeHtmlMarkdown"],"mappings":";;;;;;;;;;;;;;;;;;;;AA6Ca,MAAA,gBAAA,GAAmB,OAAO,OAAoB,KAAA;AACzD,EAAA,MAAM,OAAU,GAAA,MAAMA,sBAAG,CAAA,QAAA,CAAS,SAAS,OAAO,CAAA,CAAA;AAClD,EAAA,OAAO,QAAQ,QAAS,EAAA,CAAA;AAC1B,CAAA,CAAA;AAEa,MAAA,eAAA,GAAkB,OAAO,WAAA,EAAqB,MAAmB,KAAA;AAC5E,EAAM,MAAA,O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QAAQ,CAAC,CAAA,CAAA,SAAA,CAAA,EAAc,IAAI,CAC3D,GAAA,IAAI,OAAO,CAAwB,qBAAA,EAAA,OAAA,CAAQ,CAAC,CAAA,CAAA,SAAA,CAAA,EAAc,IAAI,CAAA,CAAA;AAClE,UAAA,SAAA,GAAY,UAAU,OAAQ,CAAA,KAAA,EAAO,CAAW,QAAA,EAAA,OAAA,CAAQ,CAAC,CAAK,CAAA,EAAA,CAAA,CAAA,CAAA;AAAA,SAC/D,CAAA,CAAA;AAED,QAAI,GAAA,CAAA,MAAA,CAAO,KAAK,CAA0B,wBAAA,CAAA,CAAA,CAAA;AAC1C,QAAA,MAAMT,sBAAG,CAAA,UAAA;AAAA,UACP,CAAA,EAAG,OAAW,CAAA,CAAA,EAAA,gBAAA,CAAA,KAAA,EAAwB,eAAgB,CAAA,OAAA;AAAA,YACpD,MAAA;AAAA,YACA,GAAA;AAAA,WACF,CAAA,GAAA,CAAA;AAAA,UACA,SAAA;AAAA,SACF,CAAA;AAAA,OACF;AAEA,MAAI,GAAA,CAAA,MAAA,CAAO,MAAQ,EAAA,aAAA,CAAc,IAAI,CAAA,CAAA;AACrC,MAAI,GAAA,CAAA,MAAA,CAAO,OAAS,EAAA,aAAA,CAAc,KAAK,CAAA,CAAA;AAAA,KACzC;AAAA,GACD,CAAA,CAAA;AACH;;;;"}
1
+ {"version":3,"file":"index.cjs.js","sources":["../src/actions/confluence/helpers.ts","../src/actions/confluence/confluenceToMarkdown.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Config } from '@backstage/config';\nimport { ResponseError, ConflictError, InputError } from '@backstage/errors';\nimport fs from 'fs-extra';\nimport fetch, { Response } from 'node-fetch';\n\ninterface Links {\n webui: string;\n download: string;\n thumbnail: string;\n self: string;\n}\n\ninterface Metadata {\n mediaType: string;\n}\n\nexport interface Result {\n id: string;\n type: string;\n status: string;\n title: string;\n metadata: Metadata;\n _links: Links;\n}\n\nexport interface Results {\n results: Result[];\n}\n\nexport const readFileAsString = async (fileDir: string) => {\n const content = await fs.readFile(fileDir, 'utf-8');\n return content.toString();\n};\n\nexport const fetchConfluence = async (relativeUrl: string, config: Config) => {\n const baseUrl = config.getString('confluence.baseUrl');\n const token = config.getString('confluence.token');\n const response: Response = await fetch(`${baseUrl}${relativeUrl}`, {\n method: 'GET',\n headers: {\n Authorization: `Bearer ${token}`,\n },\n });\n if (!response.ok) {\n throw await ResponseError.fromResponse(response);\n }\n\n return response.json();\n};\n\nexport const getAndWriteAttachments = async (\n arr: Results,\n workspace: string,\n config: Config,\n mkdocsDir: string,\n) => {\n const productArr: string[][] = [];\n const baseUrl = config.getString('confluence.baseUrl');\n const token = config.getString('confluence.token');\n await Promise.all(\n await arr.results.map(async (result: Result) => {\n const downloadLink = result._links.download;\n const downloadTitle = result.title.replace(/ /g, '-');\n if (result.metadata.mediaType !== 'application/gliffy+json') {\n productArr.push([result.title.replace(/ /g, '%20'), downloadTitle]);\n }\n\n const res = await fetch(`${baseUrl}${downloadLink}`, {\n method: 'GET',\n headers: {\n Authorization: `Bearer ${token}`,\n },\n });\n if (!res.ok) {\n throw ResponseError.fromResponse(res);\n } else if (res.body !== null) {\n fs.openSync(`${workspace}/${mkdocsDir}docs/img/${downloadTitle}`, 'w');\n const writeStream = fs.createWriteStream(\n `${workspace}/${mkdocsDir}docs/img/${downloadTitle}`,\n );\n res.body.pipe(writeStream);\n await new Promise((resolve, reject) => {\n writeStream.on('finish', () => {\n resolve(`${workspace}/${mkdocsDir}docs/img/${downloadTitle}`);\n });\n writeStream.on('error', reject);\n });\n } else {\n throw new ConflictError(\n 'No Body on the response. Can not save images from Confluence Doc',\n );\n }\n }),\n );\n return productArr;\n};\n\nexport const createConfluenceVariables = async (url: string) => {\n let spacekey: string | undefined = undefined;\n let title: string | undefined = undefined;\n let titleWithSpaces: string | undefined = '';\n const params = new URL(url);\n if (params.pathname.split('/')[1] === 'display') {\n spacekey = params.pathname.split('/')[2];\n title = params.pathname.split('/')[3];\n titleWithSpaces = title?.replace(/\\+/g, ' ');\n return { spacekey, title, titleWithSpaces };\n }\n throw new InputError(\n 'The Url format for Confluence is incorrect. Acceptable format is `<CONFLUENCE_BASE_URL>/display/<SPACEKEY>/<PAGE+TITLE>`',\n );\n};\n","/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { Config } from '@backstage/config';\nimport { UrlReader } from '@backstage/backend-common';\nimport { ScmIntegrations } from '@backstage/integration';\nimport { createFetchPlainAction } from '@backstage/plugin-scaffolder-backend';\nimport { createTemplateAction } from '@backstage/plugin-scaffolder-node';\nimport { InputError, ConflictError } from '@backstage/errors';\nimport { NodeHtmlMarkdown } from 'node-html-markdown';\nimport fs from 'fs-extra';\nimport parseGitUrl from 'git-url-parse';\nimport YAML from 'yaml';\nimport {\n readFileAsString,\n fetchConfluence,\n getAndWriteAttachments,\n createConfluenceVariables,\n} from './helpers';\n\n/**\n * @public\n */\n\nexport const createConfluenceToMarkdownAction = (options: {\n reader: UrlReader;\n integrations: ScmIntegrations;\n config: Config;\n}) => {\n const { config, reader, integrations } = options;\n const fetchPlainAction = createFetchPlainAction({ reader, integrations });\n type Obj = {\n [key: string]: string;\n };\n\n return createTemplateAction<{\n confluenceUrls: string[];\n repoUrl: string;\n }>({\n id: 'confluence:transform:markdown',\n schema: {\n input: {\n properties: {\n confluenceUrls: {\n type: 'array',\n title: 'Confluence URL',\n description:\n 'Paste your confluence url. Ensure it follows this format: https://{confluence+base+url}/display/{spacekey}/{page+title}',\n items: {\n type: 'string',\n default: 'Confluence URL',\n },\n },\n repoUrl: {\n type: 'string',\n title: 'GitHub Repo Url',\n description:\n 'mkdocs.yml file location inside the github repo you want to store the document',\n },\n },\n },\n },\n async handler(ctx) {\n const { confluenceUrls, repoUrl } = ctx.input;\n const parsedRepoUrl = parseGitUrl(repoUrl);\n const filePathToMkdocs = parsedRepoUrl.filepath.substring(\n 0,\n parsedRepoUrl.filepath.lastIndexOf('/') + 1,\n );\n const dirPath = ctx.workspacePath;\n let productArray: string[][] = [];\n\n ctx.logger.info(`Fetching the mkdocs.yml catalog from ${repoUrl}`);\n\n // This grabs the files from Github\n const repoFileDir = `${dirPath}/${parsedRepoUrl.filepath}`;\n await fetchPlainAction.handler({\n ...ctx,\n input: {\n url: `https://${parsedRepoUrl.resource}/${parsedRepoUrl.owner}/${parsedRepoUrl.name}`,\n targetPath: dirPath,\n },\n });\n\n for (const url of confluenceUrls) {\n const { spacekey, title, titleWithSpaces } =\n await createConfluenceVariables(url);\n // This calls confluence to get the page html and page id\n const getConfluenceDoc = await fetchConfluence(\n `/rest/api/content?title=${title}&spaceKey=${spacekey}&expand=body.export_view`,\n config,\n );\n if (getConfluenceDoc.results.length === 0) {\n throw new InputError(\n `Could not find document ${url}. Please check your input.`,\n );\n }\n // This gets attachments for the confluence page if they exist\n const getDocAttachments = await fetchConfluence(\n `/rest/api/content/${getConfluenceDoc.results[0].id}/child/attachment`,\n config,\n );\n\n if (getDocAttachments.results.length) {\n fs.mkdirSync(`${dirPath}/${filePathToMkdocs}docs/img`, {\n recursive: true,\n });\n productArray = await getAndWriteAttachments(\n getDocAttachments,\n dirPath,\n config,\n filePathToMkdocs,\n );\n }\n\n ctx.logger.info(\n `starting action for converting ${titleWithSpaces} from Confluence To Markdown`,\n );\n\n // This reads mkdocs.yml file\n const mkdocsFileContent = await readFileAsString(repoFileDir);\n const mkdocsFile = await YAML.parse(mkdocsFileContent);\n ctx.logger.info(\n `Adding new file - ${titleWithSpaces} to the current mkdocs.yml file`,\n );\n\n // This modifies the mkdocs.yml file\n if (mkdocsFile !== undefined && mkdocsFile.hasOwnProperty('nav')) {\n const { nav } = mkdocsFile;\n if (!nav.some((i: Obj) => i.hasOwnProperty(titleWithSpaces))) {\n nav.push({\n [titleWithSpaces]: `${titleWithSpaces.replace(/\\s+/g, '-')}.md`,\n });\n mkdocsFile.nav = nav;\n } else {\n throw new ConflictError(\n 'This document looks to exist inside the GitHub repo. Will end the action.',\n );\n }\n }\n\n await fs.writeFile(repoFileDir, YAML.stringify(mkdocsFile));\n\n // This grabs the confluence html and converts it to markdown and adds attachments\n const html = getConfluenceDoc.results[0].body.export_view.value;\n const markdownToPublish = NodeHtmlMarkdown.translate(html);\n let newString: string = markdownToPublish;\n productArray.forEach((product: string[]) => {\n // This regex is looking for either [](link to confluence) or ![](link to confluence) in the newly created markdown doc and updating it to point to the versions saved(in ./docs/img) in the local version of GitHub Repo during getAndWriteAttachments\n const regex = product[0].includes('.pdf')\n ? new RegExp(`(\\\\[.*?\\\\]\\\\()(.*?${product[0]}.*?)(\\\\))`, 'gi')\n : new RegExp(`(\\\\!\\\\[.*?\\\\]\\\\()(.*?${product[0]}.*?)(\\\\))`, 'gi');\n newString = newString.replace(regex, `$1./img/${product[1]}$3`);\n });\n\n ctx.logger.info(`Adding new file to repo.`);\n await fs.outputFile(\n `${dirPath}/${filePathToMkdocs}docs/${titleWithSpaces.replace(\n /\\s+/g,\n '-',\n )}.md`,\n newString,\n );\n }\n\n ctx.output('repo', parsedRepoUrl.name);\n ctx.output('owner', parsedRepoUrl.owner);\n },\n });\n};\n"],"names":["fs","fetch","ResponseError","ConflictError","InputError","createFetchPlainAction","createT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backstage/plugin-scaffolder-backend-module-confluence-to-markdown",
3
3
  "description": "The confluence-to-markdown module for @backstage/plugin-scaffolder-backend",
4
- "version": "0.1.2-next.0",
4
+ "version": "0.1.2-next.1",
5
5
  "main": "dist/index.cjs.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "license": "Apache-2.0",
@@ -24,12 +24,12 @@
24
24
  "help": "backstage-cli help"
25
25
  },
26
26
  "dependencies": {
27
- "@backstage/backend-common": "^0.18.5-next.0",
27
+ "@backstage/backend-common": "^0.18.5-next.1",
28
28
  "@backstage/config": "^1.0.7",
29
29
  "@backstage/errors": "^1.1.5",
30
30
  "@backstage/integration": "^1.4.5-next.0",
31
- "@backstage/plugin-scaffolder-backend": "^1.13.2-next.0",
32
- "@backstage/plugin-scaffolder-node": "^0.1.3-next.0",
31
+ "@backstage/plugin-scaffolder-backend": "^1.13.2-next.1",
32
+ "@backstage/plugin-scaffolder-node": "^0.1.3-next.1",
33
33
  "@backstage/types": "^1.0.2",
34
34
  "fs-extra": "10.1.0",
35
35
  "git-url-parse": "^13.1.0",
@@ -38,7 +38,7 @@
38
38
  "yaml": "^2.0.0"
39
39
  },
40
40
  "devDependencies": {
41
- "@backstage/backend-test-utils": "^0.1.37-next.0",
41
+ "@backstage/backend-test-utils": "^0.1.37-next.1",
42
42
  "@backstage/cli": "^0.22.7-next.0",
43
43
  "mock-fs": "^5.2.0",
44
44
  "msw": "^1.0.0"